module.exports = {
  'admin/gongxufabu/listall': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '信息编号',
        value: 'fabu_no'
      },
      {
        label: '发布方类型',
        value: function(row, field) {
          return get_groupname(row.fabureninfo.groupid);
        }
      },
      {
        label: '发布方电话',
        value: 'fabureninfo.mobile'
      },
      {
        label: '发布方姓名',
        value: 'fabureninfo.real_name'
      },
      {
        label: '发布方公司名称',
        value: 'fabureninfo.gsmc'
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.xinxileixing);
        }
      },
      {
        label: '申请时间',
        value: 'chuangjianshijian'
      },
      {
        label: '审核状态',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.operation_value) {
            var operation_value = JSON.parse(row.check_remark.operation_value);
            return get_gongxufabu_check_status(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '审核时间',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.remark_time) {
            return moment(row.check_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '审核退回类型',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.operation_value) {
            var operation_value = JSON.parse(row.check_remark.operation_value);
            return operation_value.problem_type;
          } else {
            return '';
          }
        }
      },
      {
        label: '推送公司名称',
        value: 'zzjginfo.zzjg'
      },
      {
        label: '上架状态',
        value: function(row, field) {
          return get_gongxufabu_sale_status(row.status);
        }
      },
      {
        label: '上架时间',
        value: function(row, field) {
          if (row.sale_time) {
            return moment(row.sale_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '下架时间',
        value: function(row, field) {
          if (row.offsale_remark && row.offsale_remark.remark_time) {
            return moment(row.offsale_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '下架类型',
        value: function(row, field) {
          if (row.offsale_remark && row.offsale_remark.operation_value) {
            var operation_value = JSON.parse(row.offsale_remark.operation_value);
            return operation_value.problem_type;
          } else {
            return '';
          }
        }
      },
      {
        label: '存续状态',
        value: function(row, field) {
          if ((row.check_remark && row.check_remark.operation == '退回') || (row.faburen_remark && row.faburen_remark.operation == '撤销') || (row.offsale_remark && row.offsale_remark.operation == '下架')) {
            return '已撤销';
          } else {
            return '未撤销';
          }
        }
      },
      {
        label: '撤销时间',
        value: function(row, field) {
          if ((row.check_remark && row.check_remark.operation == '退回') || (row.faburen_remark && row.faburen_remark.operation == '撤销') || (row.offsale_remark && row.offsale_remark.operation == '下架')) {
            return row.check_remark && moment(row.check_remark.remark_time).format('YYYY-MM-DD HH:mm:ss') || row.faburen_remark && moment(row.faburen_remark.remark_time).format('YYYY-MM-DD HH:mm:ss') || row.offsale_remark && moment(row.offsale_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '派单状态',
        value: function(row, field) {
          if (row.pushinfo && row.send_remark) {
            return '已派单';
          } else if (row.pushinfo) {
            return '未派单';
          } else {
            return '';
          }
        }
      },
      {
        label: '派单时间',
        value: function(row, field) {
          if (row.pushinfo && row.send_remark) {
            return moment(row.send_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '派单人员',
        value: function(row, field) {
          if (row.pushinfo && row.send_remark) {
            return row.assigninfo.real_name;
          } else {
            return '';
          }
        }
      },
      {
        label: '复核时间',
        value: function(row, field) {
          if (row.review_remark) {
            return moment(row.review_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '复核结果',
        value: function(row, field) {
          if (row.review_remark) {
            var operation_value = JSON.parse(row.review_remark.operation_value);
            return get_gongxustatus(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '复核退回类型',
        value: function(row, field) {
          if (row.review_remark) {
            var operation_value = JSON.parse(row.review_remark.operation_value);
            return operation_value.problem_type;
          } else {
            return '';
          }
        }
      },
      {
        label: '问题信息认定方式',
        value: function(row, field) {
          if (row.decision_problem_node) {
            return get_remark_type(row.decision_problem_node);
          } else {
            return '';
          }
        }
      }
    ]
  },
  'admin/gongxufabu/listsale': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '信息编号',
        value: 'fabu_no'
      },
      {
        label: '发布方类型',
        value: function(row, field) {
          return get_groupname(row.fabureninfo.groupid);
        }
      },
      {
        label: '发布方电话',
        value: 'fabureninfo.mobile'
      },
      {
        label: '发布方姓名',
        value: 'fabureninfo.real_name'
      },
      {
        label: '发布方公司名称',
        value: 'fabureninfo.gsmc'
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.xinxileixing);
        }
      },
      {
        label: '信息通道',
        value: function(row, field) {
          return get_channelname(row.info_channel);
        }
      },
      {
        label: '有效期限',
        value: function(row, field) {
          return moment(row.chuangjianshijian).add(get_youxiaotianshu(row.youxiaoqi), 'days').format('YYYY-MM-DD HH:mm:ss');
        }
      }
    ]
  },
  'admin/gongxufabu/listsended': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '信息编号',
        value: 'fabu_no'
      },
      {
        label: '发布方电话',
        value: 'fabureninfo.mobile'
      },
      {
        label: '发布方姓名',
        value: 'fabureninfo.real_name'
      },
      {
        label: '发布方公司名称',
        value: 'fabureninfo.gsmc'
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '数量(吨)',
        value: 'shangpingshuliang'
      },
      {
        label: '价格(元/吨)',
        value: 'jiage'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.xinxileixing);
        }
      },
      {
        label: '我方公司名称',
        value: 'zzjginfo.zzjg'
      },
      {
        label: '审核时间',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.remark_time) {
            return moment(row.check_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '派单时间',
        value: function(row, field) {
          if (row.send_remark && row.send_remark.remark_time) {
            return moment(row.send_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '业务员姓名',
        value: 'assigninfo.real_name'
      },
      {
        label: '业务员姓名',
        value: 'assigninfo.gsmc'
      },
      {
        label: '业务员电话',
        value: 'assigninfo.mobile'
      }
    ]
  },
  'admin/gongxufabu/listreviewed': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '信息编号',
        value: 'fabu_no'
      },
      {
        label: '发布方电话',
        value: 'fabureninfo.mobile'
      },
      {
        label: '发布方姓名',
        value: 'fabureninfo.real_name'
      },
      {
        label: '发布方公司名称',
        value: 'fabureninfo.gsmc'
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.xinxileixing);
        }
      },
      {
        label: '我方公司名称',
        value: 'zzjginfo.zzjg'
      },
      {
        label: '业务员姓名',
        value: 'assigninfo.real_name'
      },
      {
        label: '业务员电话',
        value: 'appmobile'
      },
      {
        label: '反馈时间',
        value: function(row, field) {
          if (row.recipient_remark && row.recipient_remark.remark_time) {
            return moment(row.recipient_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '复核时间',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.remark_time) {
            return moment(row.review_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '复核结果',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.operation_value) {
            var operation_value = JSON.parse(row.review_remark.operation_value);
            return get_gongxustatus(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '退回类型',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.operation_value) {
            var operation_value = JSON.parse(row.review_remark.operation_value);
            return operation_value.problem_type;
          } else {
            return '';
          }
        }
      }
    ]
  },
  'admin/gongxufabu/listchecked': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '信息编号',
        value: 'fabu_no'
      },
      {
        label: '发布方类型',
        value: function(row, field) {
          return get_groupname(row.fabureninfo.groupid);
        }
      },
      {
        label: '发布方电话',
        value: 'fabureninfo.mobile'
      },
      {
        label: '发布方姓名',
        value: 'fabureninfo.real_name'
      },
      {
        label: '发布方公司名称',
        value: 'fabureninfo.gsmc'
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.xinxileixing);
        }
      },
      {
        label: '申请时间',
        value: 'chuangjianshijian'
      },
      {
        label: '审核状态',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.operation_value) {
            var operation_value = JSON.parse(row.check_remark.operation_value);
            return get_gongxufabu_check_status(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '审核时间',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.remark_time) {
            return moment(row.check_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '审核结果',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.operation_value) {
            var operation_value = JSON.parse(row.check_remark.operation_value);
            return get_gongxustatus(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '退回类型',
        value: function(row, field) {
          if (row.check_remark && row.check_remark.operation_value) {
            var operation_value = JSON.parse(row.check_remark.operation_value);
            return operation_value.problem_type;
          } else {
            return '';
          }
        }
      },
      {
        label: '推送公司名称',
        value: 'zzjginfo.zzjg'
      }
    ]
  },
  'admin/gongxufabu/listproblem': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '信息编号',
        value: 'fabu_no'
      },
      {
        label: '问题方姓名',
        value: 'fabureninfo.real_name'
      },
      {
        label: '问题方公司',
        value: 'fabureninfo.gsmc'
      },
      {
        label: '问题方电话',
        value: 'fabureninfo.mobile'
      },

      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.xinxileixing);
        }
      },
      {
        label: '反馈方公司',
        value: 'decision_problem_userinfo.gsmc'
      },
      {
        label: '反馈方姓名',
        value: 'decision_problem_userinfo.real_name'
      },
      {
        label: '反馈方电话',
        value: 'decision_problem_userinfo.mobile'
      },
      {
        label: '问题信息认定时间',
        value: function(row, field) {
          if (row.decision_problem_time) {
            return moment(row.decision_problem_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '问题信息认定方式',
        value: function(row, field) {
          return get_remark_type(row.decision_problem_node);
        }
      }
    ]
  },
  'admin/order/list': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '订单编号',
        value: 'order_no'
      },
      {
        label: '下单方类型',
        value: function(row, field) {
          return get_groupname(row.order_userinfo.groupid);
        }
      },
      {
        label: '下单方姓名',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return row.xu_username;
          } else {
            return row.gong_username;
          }
        }
      },
      {
        label: '下单方公司名称',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return row.xu_gsmc;
          } else {
            return row.gong_gsmc;
          }
        }
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.yewuleixing);
        }
      },
      {
        label: '信息通道',
        value: function(row, field) {
          return get_channelname(row.info_channel);
        }
      },
      {
        label: '买方/委托方电话',
        value: 'xu_mobile'
      },
      {
        label: '买方/委托方姓名',
        value: 'xu_username'
      },
      {
        label: '买方/委托方公司',
        value: 'xu_gsmc'
      },
      {
        label: '卖方/承接方电话',
        value: 'gong_mobile'
      },
      {
        label: '卖方/承接方姓名',
        value: 'gong_username'
      },
      {
        label: '卖方/承接方公司',
        value: 'gong_gsmc'
      },
      {
        label: '下单时间',
        value: 'chuangjianshijian'
      },
      {
        label: '存续状态',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return get_cunxuname(row.xuqueren);
          } else {
            return get_cunxuname(row.gongqueren);
          }
        }
      },
      {
        label: '确认状态',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return get_querenname(row.gongqueren);
          } else {
            return get_querenname(row.xuqueren);
          }
        }
      },
      {
        label: '复核时间',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.remark_time) {
            return moment(row.review_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '复核结果',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.operation_value) {
            var operation_value = JSON.parse(row.review_remark.operation_value);
            return get_orderstatus(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '终止类型',
        value: 'problem_type'
      },
      {
        label: '问题订单认定方式',
        value: function(row, field) {
          if (row.decision_problem_node) {
            return get_remark_type(row.decision_problem_node);
          } else {
            return '';
          }
        }
      }
    ]
  },
  'admin/order/listreviewed': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '订单编号',
        value: 'order_no'
      },
      {
        label: '下单方类型',
        value: function(row, field) {
          return get_groupname(row.order_userinfo.groupid);
        }
      },
      {
        label: '下单方姓名',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return row.xu_username;
          } else {
            return row.gong_username;
          }
        }
      },
      {
        label: '下单方公司名称',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return row.xu_gsmc;
          } else {
            return row.gong_gsmc;
          }
        }
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.yewuleixing);
        }
      },
      {
        label: '信息通道',
        value: function(row, field) {
          return get_channelname(row.info_channel);
        }
      },
      {
        label: '买方/委托方电话',
        value: 'xu_mobile'
      },
      {
        label: '买方/委托方姓名',
        value: 'xu_username'
      },
      {
        label: '买方/委托方公司',
        value: 'xu_gsmc'
      },
      {
        label: '卖方/承接方电话',
        value: 'gong_mobile'
      },
      {
        label: '卖方/承接方姓名',
        value: 'gong_username'
      },
      {
        label: '卖方/承接方公司',
        value: 'gong_gsmc'
      },
      {
        label: '下单时间',
        value: 'chuangjianshijian'
      },
      {
        label: '存续状态',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return get_cunxuname(row.xuqueren);
          } else {
            return get_cunxuname(row.gongqueren);
          }
        }
      },
      {
        label: '确认状态',
        value: function(row, field) {
          if (row.order_userid == row.xuid) {
            return get_querenname(row.gongqueren);
          } else {
            return get_querenname(row.xuqueren);
          }
        }
      },
      {
        label: '复核时间',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.remark_time) {
            return moment(row.review_remark.remark_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '复核结果',
        value: function(row, field) {
          if (row.review_remark && row.review_remark.operation_value) {
            var operation_value = JSON.parse(row.review_remark.operation_value);
            return get_orderstatus(operation_value.status);
          } else {
            return '';
          }
        }
      },
      {
        label: '终止类型',
        value: 'problem_type'
      }
    ]
  },
  'admin/order/listproblem': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '订单编号',
        value: 'order_no'
      },
      {
        label: '问题方姓名',
        value: 'problem_userinfo.real_name'
      },
      {
        label: '问题方公司',
        value: 'problem_userinfo.gsmc'
      },
      {
        label: '问题方电话',
        value: 'problem_userinfo.mobile'
      },
      {
        label: '商品类别',
        value: 'shangpingleibie'
      },
      {
        label: '所在地区',
        value: 'diqu'
      },
      {
        label: '信息类型',
        value: function(row, field) {
          return get_gongxutype(row.yewuleixing);
        }
      },
      {
        label: '反馈方公司',
        value: 'decision_problem_userinfo.gsmc'
      },
      {
        label: '反馈方姓名',
        value: 'decision_problem_userinfo.real_name'
      },
      {
        label: '反馈方电话',
        value: 'decision_problem_userinfo.mobile'
      },
      {
        label: '问题订单认定时间',
        value: function(row, field) {
          if (row.decision_problem_time) {
            return moment(row.decision_problem_time).format('YYYY-MM-DD HH:mm:ss');
          } else {
            return '';
          }
        }
      },
      {
        label: '问题订单认定方式',
        value: function(row, field) {
          return get_remark_type(row.decision_problem_node);
        }
      }
    ]
  },
  'admin/material/index': {
    withBOM: true,
    excelStrings: true,
    fields: [
      // Supports label -> simple path
      {
        label: '序号',
        value: function(row, field) {
          return field.default++;
        },
        default: 1
      },
      {
        label: '物料名称',
        value: 'label'
      },
      {
        label: '添加时间',
        value: function(row, field) {
          return moment(row.create_time).format('YYYY-MM-DD HH:mm:ss');
        }
      },
      {
        label: '状态',
        value: function(row, field) {
          var map = {
            '0': '停用',
            '1': '启用',
            '-1': '删除'
          };
          return map[row.status];
        }
      }
    ]
  }
};
